#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// 1、编写一个程序，该程序读取输入直到遇到#字符，然后报告读取的空格数目、读取的换行符数目以及读取的所有其他字符数目例如:
// 输入:a 3 b
// C%#
// 输出:spaces=2,enter=1,characters=5

int main()
{

    int *spaces = malloc(sizeof(int));
    int *enter = malloc(sizeof(int));
    int *characters = malloc(sizeof(int));
    *spaces = 0;
    *enter = 0;
    *characters = 0;
    char *str = (char *)malloc(100);
    int *i = calloc(1, 4);
    while ((str[*i] = getchar()) != '#')
    {
        if (str[*i] == ' ')
        {
            (*spaces)++;
        }
        else if (str[*i] == '\n')
        {
            (*enter)++;
        }
        else
        {
            (*characters)++;
        }
        (*i)++;
    }
    printf("spaces=%d,enter=%d,characters=%d", *spaces, *enter, *characters);
    free(str);
    free(spaces);
    free(enter);
    free(characters);
    free(i);
    return 0;
}